package com.zys.exercise;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class text4 {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        ArrayList<String> list2 = new ArrayList<>();
        Collections.addAll(list1,"aaa,24","bb,23","ccc,24","ddd,25");
        Collections.addAll(list2,"a,24","b,23","c,24","d,25");
        Stream<String> limit1 = list1.stream()
                .filter(s -> s.split(",")[0].length() == 3)
                .limit(2);
        Stream<String> stream2 = list2.stream();
        List<Actor> collect = Stream.concat(limit1, stream2)
                .map(s-> new Actor(s.split(",")[0],Integer.parseInt(s.split(",")[1])))
                .collect(Collectors.toList());
        System.out.println(collect);
    }
}
